/**
 * @Author ZhangCuirong
 * @Date 2025/9/2 8:40
 * @description:
 */
public class Solution191 {
    public int hammingWeight(int n) {
        int res = 0;
        while (n != 0) {
            n = n & (n - 1);
            res++;
        }
        return res;
    }
}
